package cn.idietrade.idietradegoodsmodule8002.service.goodsservice.impl;

import cn.idietrade.common.pojo.SecondGoods;
import cn.idietrade.common.utils.EmptyUtils;
import cn.idietrade.common.utils.ReturnResultData;
import cn.idietrade.idietradegoodsmodule8002.mapper.SecondGoodsMapper;
import cn.idietrade.idietradegoodsmodule8002.service.goodsservice.GoodsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 作者
 * @createTime 2022/11/30 16:15
 * @description 描述
 */
@Service
public class GoodsServiceImpl implements GoodsService {

    @Resource
    private SecondGoodsMapper goodsMapper;

    @Override
    public ReturnResultData goodsCity(Integer cid) {
        ReturnResultData resultData = new ReturnResultData();
        if(!EmptyUtils.isEmpty(cid)){
            List<SecondGoods> goodsCityList = goodsMapper.goodsCity(cid);
            resultData.setCode(1);
            resultData.setMessage("根据城市id查询商品成功");
            resultData.setData(goodsCityList);
        }else {
            resultData.setCode(0);
            resultData.setMessage("数据异常请与管理员联系");
            resultData.setData(null);
        }
        return resultData;
    }

}
